package shixhun;

public class demoe5  {
    public static void main(String[] args){
        String str1="1235";
        String regex="[0-9]{4}";
        System.out.println(str1.matches(regex));
        String str2 = "12345678";
        String regex1 = "[0-9]{6,9}";
        System.out.println(str2.matches(regex1));
        //转义字符\d，转义为数字0-9
        regex1="\\d{6,9}";
        System.out.println(str2.matches(regex1));
        regex1="^\\d{6,9}$";
        System.out.println(str2.matches(regex1));
       //以^开头以$结尾
        str2="abcde;;qq";
        regex1="^\\D{6,9}$";
        //转义字符D，转义为非数字
        System.out.println(str2.matches(regex1));
    }

}
